import sys; input = sys.stdin.readline; from array import *; from random import *; seed(69) def bt(i, bm): if i == len(V): return 0 ans = bt(i+1, bm) if C[V[i]]&bm == 0: new = S[V[i]]+bt(i+1, bm|G[V[i]]) if new > ans: ans = new return ans C = array('i', [1<